package com.example.lol.ui.me;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.example.lol.base.BaseFragment;
import com.example.lol.base.BaseVpAdapter;
import com.example.lol.bean.NewsTypeBean;
import com.example.lol.ui.news.MeActivityFragment;

public class MeVpAdapter extends BaseVpAdapter<NewsTypeBean> {
    MeTzFragment postMineFragment = new MeTzFragment();
    MeActivityFragment recordMineFragment = new MeActivityFragment();

    public MeVpAdapter(@NonNull FragmentManager fm) {
        super(fm);
    }

    @Override
    protected Fragment createFragment(int position) {
        Fragment fragment = null;
        NewsTypeBean bean = getData(position);
        if (bean.getType() == NewsTypeBean.TYPE_ARTICLE){
            switch (position){
                case 0:
                    return recordMineFragment;
                case 1:
                    return postMineFragment;
            }
        }
        return fragment;
    }


    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return getData(position).getTitle();
    }
}
